package com.echo.yixiaowu.util

fun Long.formatTimeString(isMill: Boolean = true): String {
    val totalSecond = if (isMill) this / 1000 else this
    val hours = totalSecond / 3600
    val minutes = (totalSecond % 3600) / 60
    val seconds = totalSecond % 60

    val formattedMinutes = if (minutes < 10) "0$minutes" else "$minutes"
    val formattedSeconds = if (seconds < 10) "0$seconds" else "$seconds"

    return if (hours > 0) {
        val formattedHours = if (hours < 10) "0$hours" else "$hours"
        "$formattedHours:$formattedMinutes:$formattedSeconds"
    } else {
        "$formattedMinutes:$formattedSeconds"
    }
}
